<template>
	<view class="house acea-row row-center-wrapper row-column">
		
		<block v-for="(item,index) in list" :key="index">
			<view class="list" @click="urlClick(item)">
				<view class="acea-row row-middle row-between bor-bot pb30">
					<view class="acea-row row-middle">
						<view class="avatar">
							<image class="imgwh" :src="item.avatar" mode=""></image>
						</view>
						<view class="ml30">
							<view class="color333 bold fs-40">{{ item.real_name }}</view>
							<view class="color888 fs-36 mt20">性别：{{ item.sex }}</view>
						</view>
					</view>
					<view class="btn fs-30 ml30">联系管家</view>
				</view>
				<view class="color333 line1 bold fs-30 py30 line1">简介：{{ item.resume }}</view>
			</view>
		</block>
		
		<view class='loadingicon acea-row row-center-wrapper' v-if='list.length > 0'>
			<text class='loading iconfont icon-jiazai' :hidden='loading==false'></text>{{loadTitle}}
		</view>
		
		<block v-if="list.length==0">
			<view class="kong">
				<view class="acea-row row-middle row-center none-t">
					<text class="fs-32 color666">暂无更多数据~</text>
				</view>
			</view>
		</block>

		<tabbar :path="'/pages/house/index'"></tabbar>
		<suspension></suspension>
		
	</view>
</template>

<script>
	import tabbar from '@/components/tabbar.vue';
	import suspension from '@/components/suspension.vue';
	import{
		guanjiaList
	} from '@/api/admin.js'
	export default {
		components:{
			tabbar,
			suspension
		},
		data() {
			return {
				page:1,
				limit:10,
				list:[],
				loadend: false,
				loading: false,
				loadTitle: this.$t(`加载更多`),
			};
		},
		onLoad() {
			uni.hideTabBar()
		},
		onShow() {
			this.getlist();
		},
		methods:{
			getlist(){
				let that = this;
				if (that.loadend) return;
				if (that.loading) return;
				that.loading = true;
				that.loadTitle = '';
				guanjiaList({ page:that.page,limit:that.limit }).then(res=>{
					let list = res.data.data;
					let arr = that.$util.SplitArray(list, that.list);
					let loadend = list.length < that.limit;
					that.loadend = loadend;
					that.loading = false;
					that.loadTitle = loadend ? that.$t(`没有更多内容啦~`) : that.$t(`加载更多`);
					that.$set(that, 'list', arr);
					that.$set(that, 'page', that.page + 1);
				}).catch(err=>{
					that.loading = false;
					that.loadTitle = that.$t(`加载更多`);
				})
			},
			urlClick(item){
				uni.navigateTo({
					url: `/pages/housekeep/details?id=` + item.id
				})
			}
		},
		onReachBottom(){
			this.getlist();
		}
	}
</script>

<style lang="scss">
	.house{
		padding: 30rpx;
		
		.list{
			width: 690rpx;
			// height: 356rpx;
			border-radius: 60rpx;
			background-color: #ffffff;
			padding: 30rpx;
			margin-bottom: 30rpx;
			
			.avatar{
				width: 160rpx;
				height: 160rpx;
				border-radius: 50%;
				overflow: hidden;
			}
			
			.btn{
				width: 204rpx;
				height: 68rpx;
				text-align: center;
				line-height: 68rpx;
				color: #FD7D36;
				border-radius: 68rpx;
				background: rgba(253, 125, 54, 0.2);
			}
			
		}
		
		.kong{
			width: 520rpx;
			height: 520rpx;
			background-image: url('https://yijiaan.oss-cn-hangzhou.aliyuncs.com/pic/none-icon.png');
			background-size: 100% 100%;
			margin: 30rpx auto;
			position: relative;
			
			.none-t{
				width: 100%;
				color: #888888;
				font-size: 34rpx;
				position: absolute;
				bottom: -20rpx;
				left: 0;
				right: 0;
			}
		}

	}
</style>
